Python for Kids: The New Step-by-Step Parent-Friendly Programming Guide With Detailed Installation Instructions. To Stimulate Your Kid With Awesome Games, Activities And Coding Projects by Deep Raymond
Author:Deep, Raymond [Deep, Raymond]
Language: eng
Format: epub
Published: 2020-06-23T16:00:00+00:00
Chapter 9 For Loop
We will discuss the for loop. Just like a while loop, the for loop also repeatedly executes a set of code while the condition holds true. Once the condition becomes false, it will come out of the loop. Some basic requirements of a for loop are:
It must refer to a list or a range
It ends with a (:) colon
The code which has to be executed should be indented by one tab space
Example3:
# First Example
for letter in 'Python':
print 'Current Letter :', letter
Output:
Current Letter : P
Current Letter : y
Current Letter : t
Current Letter : h
Current Letter : o
Current Letter : n
# Second Example
fruits = ['apple', 'banana','mango'];
for fruit in fruits:
print 'Current fruit :', fruit
print "Good bye!"
Output:
Current fruit : apple
Current fruit : banana
Current fruit : mango
Good bye!
# Measure some strings
words = ['cat', 'apple', 'defenestrate']
for w in words:
print w, len(w)
Output:
cat 3
window 6
defenestrate 12
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Hands-On Python Deep Learning for the Web by Anubhav Singh(2030)
Mastering OpenCV 4 with Python by Fernández Villán Alberto;(1942)
Python Feature Engineering Cookbook by Soledad Galli(1790)
Building Serverless Python Web Services with Zappa by Abdulwahid Abdulhaque Barguzar(1740)
Python for Finance: Analyze Big Financial Data by Yves Hilpisch(1727)
Python for Finance Cookbook by Eryk Lewinson(1718)
Mastering Python Data Visualization by Kirthi Raman(1698)
PYTHON PROGRAMMING ADVANCED: The Guide for Data Analysis and Data Science. Discover Machine Learning With the Optimum Recipes for Mastering Python and ... (Crash Course Tips and Tricks Book 3) by ERIC MATTHEWS & LEWIS TAYLOR(1653)
Applied Deep Learning with Keras by Matthew Moocarme Mahla Abdolahnejad and Ritesh Bhagwat(1640)
Django 3 By Example by Antonio Melé(1611)
Supervised Machine Learning with Python by Taylor Smith(1594)
Interactive Data Visualization with Python by Anshu Kumar & Shubhangi Hora & Sharath Chandra Guntuku & Abha Belorkar(1448)
Hands-On GPU Programming with Python and CUDA by Dr. Brian Tuomanen(1360)
Hands-On Image Processing with Python by Sandipan Dey(1334)
Scientific Computing with Python 3 by Claus Fuhrer & Jan Erik Solem & Olivier Verdier(1322)
Flask Framework Cookbook by Shalabh Aggarwal(1298)
Python Deep Learning. by Ivan Vasilev(1272)
Training Systems using Python Statistical Modeling by Curtis Miller(1264)
Django 3 Web Development Cookbook - Fourth Edition by Aidas Bendoraitis(1258)
